package com.itheima.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *  * 交换机: direct_exchange_ex
 *  * 队列: direct_queue
 *  * 路由: direct
 * @作者 itcast
 * @创建日期 2020/11/4 15:28
 **/
@Configuration
public class RabbitConfig {
    @Bean
    Queue directQueue(){
        return new Queue("direct_queue");
    }
    @Bean
    Exchange exchange(){
        return new DirectExchange("direct_exchange_ex");
    }
    @Bean
    Binding binding(){
        return BindingBuilder
                .bind(directQueue())
                .to(exchange())
                .with("direct")
                .noargs();
    }
}
